package com.sduept.nwld.dataserver.controller.dataview;

import com.sduept.bigdata.web.jsf.controller.AbstractController;
import com.sduept.cim.ledger.total.model.ProtectionDeviceCount;
import com.sduept.generator.ObjectId;
import com.sduept.nwld.dataserver.manager.cim.ProtectionDeviceCountPersistManager;
import com.sduept.nwld.dataserver.manager.cim.ProtectionDeviceCountQueryManager;
import com.sduept.utils.DateUtil;
import org.apache.commons.lang.StringUtils;
import org.primefaces.event.SelectEvent;
import org.springframework.beans.factory.annotation.Autowired;

import javax.annotation.PostConstruct;
import javax.inject.Named;
import javax.faces.view.ViewScoped;
import javax.faces.context.FacesContext;
import java.text.ParseException;
import java.util.*;

/**
 * 保护设备统计Controller
 */
@Named
@ViewScoped
public class ProtectionEquipmentCountController extends AbstractController {
	private static final long serialVersionUID = 2646469479474413833L;
	@Autowired
	private ProtectionDeviceCountQueryManager countManager;
	@Autowired
	private ProtectionDeviceCountPersistManager persistManager;

	private List<ProtectionDeviceCountDTO> list = new ArrayList<ProtectionDeviceCountDTO>();
	private int statisticalDimension = 0;// 统计维度，0：调管单位，1：生产厂家，2：检修单位
	private int year = 0;// 统计年份
	private ProtectionDeviceCountDTO selectDTO = null;
	private String[] selectedVoltageArray;// 电压等级,默认只显示35，110，220，500
	private String updateTime;// 上次更新时间
	private Boolean reStatisticStatus = false;// 重新统计是否覆盖状态
	private String queryYear;// 查询年份
	private Map<String, String> summaryMap = new HashMap<>();// 汇总map

	@PostConstruct
	public void init() {
		resetQueryCriteria();// 重置查询条件
		queryByStatisticalDimensionAndYear();
	}

	/**
	 * 根据统计维度和年度查询
	 */
	public void queryByStatisticalDimensionAndYear() {
		List<ProtectionDeviceCount> countList = queryCountByCondition(year, statisticalDimension, selectedVoltageArray);
		if (countList.size() == 0) {
			persistManager.persistCountByTypeOverideManual(statisticalDimension, reStatisticStatus);
			countList = queryCountByCondition(year, statisticalDimension, selectedVoltageArray);
		}
		if (countList.size() > 0) {
			updateTime = DateUtil.getStringDate(countList.get(0).getStatisticTime(), DateUtil.pattern_ymd);
		}
		list = parseProtectionDeviceCountToDTO(countList);
	}

	/**
	 * 获取默认电压为：35，110，220，500
	 */
	private void getDefultVoltages() {
		selectedVoltageArray = new String[4];
		selectedVoltageArray[0] = "35";
		selectedVoltageArray[1] = "110";
		selectedVoltageArray[2] = "220";
		selectedVoltageArray[3] = "500";
	}

	/**
	 * 根据条件查询countList
	 * 
	 * @param year
	 * @param type
	 * @param voltages
	 * @return 
	 */
	private List<ProtectionDeviceCount> queryCountByCondition(int year, int type, String[] voltages) {
		byte m = Byte.parseByte(String.valueOf(type));
		List<ProtectionDeviceCount> countList = new ArrayList<>();
		if (voltages != null && Arrays.asList(voltages).contains("全部") || voltages.length == 0) {
			// 如果selectedVoltageArray ！=null，并且包含全部，查询全部
			countList = countManager.getProtectionDeviceCountByYearType(year, m);
		} else if (voltages == null || (voltages == null && voltages.length == 0)) {
			// 如果selectedVoltageArray == null,查询35，110，220，500
			getDefultVoltages();
			countList = countManager.getProtectionDeviceCountByYearTypeVoltage(year, m, selectedVoltageArray);
		} else {
			// 如果selectedVoltageArray ！=null，并且不包含全部，则根据selectedVoltageArray查询
			countList = countManager.getProtectionDeviceCountByYearTypeVoltage(year, m, voltages);
		}
		return countList;
	}

	/**
	 * 将ProtectionDeviceCount转换为ProtectionDeviceCountDTO
	 * 
	 * @return 1.countList：需要转换的ProtectionDeviceCount list
	 *         2.将countList转换成<unitNmae+voltage,List<ProtectionDeviceCount>>的map
	 *         countMap 3.循环countMap,根据类型，封装ProtectionDeviceCountDTO
	 */
	private List<ProtectionDeviceCountDTO> parseProtectionDeviceCountToDTO(List<ProtectionDeviceCount> countList) {
		Map<String, List<ProtectionDeviceCount>> countMap = encapsulationCountByByUnitNameAndVoltage(countList);
		List<ProtectionDeviceCountDTO> dtoList = new ArrayList<>();
		for (String key : countMap.keySet()) {
			List<ProtectionDeviceCount> keyList = countMap.get(key);
			ProtectionDeviceCountDTO dto = new ProtectionDeviceCountDTO();
			dto.setId(ObjectId.get().toString());
			dto.setVoltage(keyList.get(0).getVoltageLevel() == null ? 0 : keyList.get(0).getVoltageLevel());
			dto.setUnitName(keyList.get(0).getUnitName());
			dtoList.add(dto);
			for (ProtectionDeviceCount count : keyList) {
				dto = setCountNumByStatisticType(dto, count);
			}
			dto.setSummary(getRowSummary(dto));
		}
		sortProtectionDTOListByName(dtoList);
		getSummaryCount(dtoList);
		return dtoList;
	}

	/**
	 * 获取汇总信息
	 * 
	 * @param dtoList
	 */
	private void getSummaryCount(List<ProtectionDeviceCountDTO> dtoList) {
		long unknowProCount = 0;// 未知类型
		long lineProCount = 0;// 线路保护
		long busProCount = 0;// 母线保护
		long transformerProCount = 0;// 变压器
		long alternatorProCount = 0;// 发电机
		long reactorProCount = 0;// 电抗器
		long seriesCompensationProCount = 0;// 串补保护
		long shortLeadProCount = 0;// 短引线保护
		long breakerProCount = 0;// 断路器保护s
		long recorderProCount = 0;// 录波器保护
		long summary = 0;// 汇总 合计
		for (ProtectionDeviceCountDTO dto : dtoList) {
			unknowProCount = (dto.getUnknowProCount() == null ? 0 : dto.getUnknowProCount()) + unknowProCount;
			lineProCount = (dto.getLineProCount() == null ? 0 : dto.getLineProCount()) + lineProCount;
			busProCount = (dto.getBusProCount() == null ? 0 : dto.getBusProCount()) + busProCount;
			transformerProCount = (dto.getTransformerProCount() == null ? 0 : dto.getTransformerProCount())
					+ transformerProCount;
			alternatorProCount = (dto.getAlternatorProCount() == null ? 0 : dto.getAlternatorProCount())
					+ alternatorProCount;
			reactorProCount = (dto.getReactorProCount() == null ? 0 : dto.getReactorProCount()) + reactorProCount;
			seriesCompensationProCount = (dto.getSeriesCompensationProCount() == null ? 0
					: dto.getSeriesCompensationProCount()) + seriesCompensationProCount;
			shortLeadProCount = (dto.getShortLeadProCount() == null ? 0 : dto.getShortLeadProCount())
					+ shortLeadProCount;
			breakerProCount = (dto.getBreakerProCount() == null ? 0 : dto.getBreakerProCount()) + breakerProCount;
			recorderProCount = (dto.getRecorderProCount() == null ? 0 : dto.getRecorderProCount()) + recorderProCount;
			summary = (dto.getSummary() == null ? 0 : dto.getSummary()) + summary;
		}
		/**
		 * 保护类型 -1：未知 0：线路、辅助保护 1：母线保护 2：变压器保护 3：发电机保护 4：电抗器保护 5：串补保护 6：短引线保护 7：断路器保护
		 * 8：故障录波器 9：网络设备
		 */
		summaryMap.put("-1", String.valueOf(unknowProCount));
		summaryMap.put("0", String.valueOf(lineProCount));
		summaryMap.put("1", String.valueOf(busProCount));
		summaryMap.put("2", String.valueOf(transformerProCount));
		summaryMap.put("3", String.valueOf(alternatorProCount));
		summaryMap.put("4", String.valueOf(reactorProCount));
		summaryMap.put("5", String.valueOf(seriesCompensationProCount));
		summaryMap.put("6", String.valueOf(shortLeadProCount));
		summaryMap.put("7", String.valueOf(breakerProCount));
		summaryMap.put("10", String.valueOf(summary));
	}

	/**
	 * 根据单位名称、电压等级unitName排序
	 * 
	 * @param protectionList
	 */
	private void sortProtectionDTOListByName(List<ProtectionDeviceCountDTO> protectionList) {
		Collections.sort(protectionList, new Comparator<ProtectionDeviceCountDTO>() {
			@Override
			public int compare(ProtectionDeviceCountDTO pro1, ProtectionDeviceCountDTO pro2) {
				String name1 = pro1.getUnitName();
				String name2 = pro2.getUnitName();
				if (StringUtils.isEmpty(name1) || StringUtils.isEmpty(name2)) {
					return 1;
				}
				int res = name1.compareTo(name2);
				if (res == 0) {
					res = pro1.getVoltage() - pro2.getVoltage();
				}
				return res;
			}

		});
	}

	/**
	 * 改变年份
	 */
	public void changeYear() {
		FacesContext context = FacesContext.getCurrentInstance();
		Map<String, String> map = context.getExternalContext().getRequestParameterMap();
		queryYear = map.get("yearAnalysis").toString();
		year = Integer.parseInt(queryYear);
	}

	public void onRowSelect(SelectEvent event) {
		selectDTO = (ProtectionDeviceCountDTO) event.getObject();
	}

	/**
	 * 根据类型获取count数量
	 * 
	 * @param count
	 * 
	 *              -1：未知 0：线路、辅助保护 1：母线保护 2：变压器保护 3：发电机保护 4：电抗器保护 5：串补保护 6：短引线保护
	 *              7：断路器保护 8：故障录波器 9：网络设备
	 * @return
	 */
	private ProtectionDeviceCountDTO setCountNumByStatisticType(ProtectionDeviceCountDTO dto,
			ProtectionDeviceCount count) {
		int statisticType = count.getStatisticType();
//		Long countNum = count.getStatisticCount() == null ? 0 : count.getStatisticCount();
		Long countNum = count.getStatisticCount() == 0 ? null : count.getStatisticCount();// 前台修改为编辑时可以存0，所以展示时0的和null的保持一致。
		switch (statisticType) {
		case -1:
			dto.setUnknowProCount(countNum);
			break;
		case 0:
			dto.setLineProCount(countNum);
			break;
		case 1:
			dto.setBusProCount(countNum);
			break;
		case 2:
			dto.setTransformerProCount(countNum);
			break;
		case 3:
			dto.setAlternatorProCount(countNum);
			break;
		case 4:
			dto.setReactorProCount(countNum);
			break;
		case 5:
			dto.setSeriesCompensationProCount(countNum);
			break;
		case 6:
			dto.setShortLeadProCount(countNum);
			break;
		case 7:
			dto.setBreakerProCount(countNum);
			break;
		case 8:
			dto.setRecorderProCount(countNum);
			break;
		case 9:
			dto.setNetworkProCount(countNum);
			break;
		}
		return dto;
	}

	/**
	 * 将countList转换成<unitName+voltage,List<ProtectionDeviceCount>>的map countMap
	 * 1.循环countList 2.每次得到一个新的unitName+voltage，就新增；如果已经拥有，就拿出来再添加
	 * 
	 * @param countList
	 * @return
	 */
	private Map<String, List<ProtectionDeviceCount>> encapsulationCountByByUnitNameAndVoltage(
			List<ProtectionDeviceCount> countList) {
		Map<String, List<ProtectionDeviceCount>> countMap = new HashMap<String, List<ProtectionDeviceCount>>();
		for (ProtectionDeviceCount count : countList) {
			String key = count.getUnitName() + count.getVoltageLevel();
			if (countMap.containsKey(key)) {
				List<ProtectionDeviceCount> keyList = countMap.get(key);
				keyList.add(count);
			} else {
				List<ProtectionDeviceCount> keyList = new ArrayList<>();
				keyList.add(count);
				countMap.put(key, keyList);
			}
		}
		return countMap;
	}

	/**
	 * 重置查询条件
	 */
	public void resetQueryCriteria() {
		getDefultVoltages();
		year = getNowYear();
		statisticalDimension = 0;
		queryByStatisticalDimensionAndYear();
	}

	/**
	 * 重新统计
	 * 
	 * @throws ParseException
	 */
	public void reStatistic() throws ParseException {
		persistManager.persistCountByTypeOverideManual(statisticalDimension, reStatisticStatus);
		queryByStatisticalDimensionAndYear();
	}

	/**
	 * 获取当前年份
	 * 
	 * @return
	 * 
	 */
	private int getNowYear() {
		Calendar date = Calendar.getInstance();
		String year = String.valueOf(date.get(Calendar.YEAR));
		return Integer.parseInt(year);
	}

	/**
	 * 1.通过电压等级查询 2.查出一个list 3.根据statisticType，进行持久化
	 * 
	 */
	public void saveProtectionDeviceCountDTO() {
		if (selectDTO != null) {
			if (selectDTO.getUnknowProCount() != null && selectDTO.getUnknowProCount() >= 0) {
				ProtectionDeviceCount count = countManager.getProtectionDeviceCountByYearTypeVoltageUnitName(year,
						Byte.parseByte(String.valueOf(statisticalDimension)), selectDTO.getVoltage(),
						selectDTO.getUnitName(), (byte) -1);
				if (count == null) {
					count = createProtectionDeviceCount((byte) 1, new Date(), (byte) -1, selectDTO.getUnitName(),
							Byte.parseByte(String.valueOf(statisticalDimension)), selectDTO.getVoltage());
				}
				count.setStatisticCount(selectDTO.getUnknowProCount());
				countManager.createOrUpdateProtectionDeviceCount(count);
			}
			if (selectDTO.getLineProCount() != null && selectDTO.getLineProCount() >= 0) {
				ProtectionDeviceCount count = countManager.getProtectionDeviceCountByYearTypeVoltageUnitName(year,
						Byte.parseByte(String.valueOf(statisticalDimension)), selectDTO.getVoltage(),
						selectDTO.getUnitName(), (byte) 0);
				if (count == null) {
					count = createProtectionDeviceCount((byte) 1, new Date(), (byte) 0, selectDTO.getUnitName(),
							Byte.parseByte(String.valueOf(statisticalDimension)), selectDTO.getVoltage());
				}
				if(count.getStatisticCount()!=selectDTO.getLineProCount()) {
					count.setOperateStatus((byte) 1);
				}
				count.setStatisticCount(selectDTO.getLineProCount());
				countManager.createOrUpdateProtectionDeviceCount(count);

			}
			if (selectDTO.getBusProCount() != null && selectDTO.getBusProCount() >= 0) {
				ProtectionDeviceCount count = countManager.getProtectionDeviceCountByYearTypeVoltageUnitName(year,
						Byte.parseByte(String.valueOf(statisticalDimension)), selectDTO.getVoltage(),
						selectDTO.getUnitName(), (byte) 1);
				if (count == null) {
					count = createProtectionDeviceCount((byte) 1, new Date(), (byte) 1, selectDTO.getUnitName(),
							Byte.parseByte(String.valueOf(statisticalDimension)), selectDTO.getVoltage());
				}
				if(count.getStatisticCount()!=selectDTO.getBusProCount()) {
					count.setOperateStatus((byte) 1);
				}
				count.setStatisticCount(selectDTO.getBusProCount());
				countManager.createOrUpdateProtectionDeviceCount(count);
			}
			if (selectDTO.getTransformerProCount() != null && selectDTO.getTransformerProCount() >= 0) {
				ProtectionDeviceCount count = countManager.getProtectionDeviceCountByYearTypeVoltageUnitName(year,
						Byte.parseByte(String.valueOf(statisticalDimension)), selectDTO.getVoltage(),
						selectDTO.getUnitName(), (byte) 2);
				if (count == null) {
					count = createProtectionDeviceCount((byte) 1, new Date(), (byte) 2, selectDTO.getUnitName(),
							Byte.parseByte(String.valueOf(statisticalDimension)), selectDTO.getVoltage());
				}
				if(count.getStatisticCount()!=selectDTO.getTransformerProCount()) {
					count.setOperateStatus((byte) 1);
				}
				count.setStatisticCount(selectDTO.getTransformerProCount());
				countManager.createOrUpdateProtectionDeviceCount(count);
			}
			if (selectDTO.getAlternatorProCount() != null && selectDTO.getAlternatorProCount() >= 0) {
				ProtectionDeviceCount count = countManager.getProtectionDeviceCountByYearTypeVoltageUnitName(year,
						Byte.parseByte(String.valueOf(statisticalDimension)), selectDTO.getVoltage(),
						selectDTO.getUnitName(), (byte) 3);
				if (count == null) {
					count = createProtectionDeviceCount((byte) 1, new Date(), (byte) 3, selectDTO.getUnitName(),
							Byte.parseByte(String.valueOf(statisticalDimension)), selectDTO.getVoltage());
				}
				if(count.getStatisticCount()!=selectDTO.getAlternatorProCount()) {
					count.setOperateStatus((byte) 1);
				}
				count.setStatisticCount(selectDTO.getAlternatorProCount());
				countManager.createOrUpdateProtectionDeviceCount(count);
			}
			if (selectDTO.getReactorProCount() != null && selectDTO.getReactorProCount() >= 0) {
				ProtectionDeviceCount count = countManager.getProtectionDeviceCountByYearTypeVoltageUnitName(year,
						Byte.parseByte(String.valueOf(statisticalDimension)), selectDTO.getVoltage(),
						selectDTO.getUnitName(), (byte) 4);
				if (count == null) {
					count = createProtectionDeviceCount((byte) 1, new Date(), (byte) 4, selectDTO.getUnitName(),
							Byte.parseByte(String.valueOf(statisticalDimension)), selectDTO.getVoltage());
				}
				if(count.getStatisticCount()!=selectDTO.getReactorProCount()) {
					count.setOperateStatus((byte) 1);
				}
				count.setStatisticCount(selectDTO.getReactorProCount());
				countManager.createOrUpdateProtectionDeviceCount(count);
			}
			if (selectDTO.getSeriesCompensationProCount() != null && selectDTO.getSeriesCompensationProCount() >= 0) {
				ProtectionDeviceCount count = countManager.getProtectionDeviceCountByYearTypeVoltageUnitName(year,
						Byte.parseByte(String.valueOf(statisticalDimension)), selectDTO.getVoltage(),
						selectDTO.getUnitName(), (byte) 5);
				if (count == null) {
					count = createProtectionDeviceCount((byte) 1, new Date(), (byte) 5, selectDTO.getUnitName(),
							Byte.parseByte(String.valueOf(statisticalDimension)), selectDTO.getVoltage());
				}
				if(count.getStatisticCount()!=selectDTO.getSeriesCompensationProCount()) {
					count.setOperateStatus((byte) 1);
				}
				count.setStatisticCount(selectDTO.getSeriesCompensationProCount());
				countManager.createOrUpdateProtectionDeviceCount(count);

			}
			if (selectDTO.getShortLeadProCount() != null && selectDTO.getShortLeadProCount() >= 0) {
				ProtectionDeviceCount count = countManager.getProtectionDeviceCountByYearTypeVoltageUnitName(year,
						Byte.parseByte(String.valueOf(statisticalDimension)), selectDTO.getVoltage(),
						selectDTO.getUnitName(), (byte) 6);
				if (count == null) {
					count = createProtectionDeviceCount((byte) 1, new Date(), (byte) 6, selectDTO.getUnitName(),
							Byte.parseByte(String.valueOf(statisticalDimension)), selectDTO.getVoltage());
				}
				if(count.getStatisticCount()!=selectDTO.getShortLeadProCount()) {
					count.setOperateStatus((byte) 1);
				}
				count.setStatisticCount(selectDTO.getShortLeadProCount());
				countManager.createOrUpdateProtectionDeviceCount(count);

			}
			if (selectDTO.getBreakerProCount() != null && selectDTO.getBreakerProCount() >= 0) {
				ProtectionDeviceCount count = countManager.getProtectionDeviceCountByYearTypeVoltageUnitName(year,
						Byte.parseByte(String.valueOf(statisticalDimension)), selectDTO.getVoltage(),
						selectDTO.getUnitName(), (byte) 7);
				if (count == null) {
					count = createProtectionDeviceCount((byte) 1, new Date(), (byte) 7, selectDTO.getUnitName(),
							Byte.parseByte(String.valueOf(statisticalDimension)), selectDTO.getVoltage());
				}
				if(count.getStatisticCount()!=selectDTO.getBreakerProCount()) {
					count.setOperateStatus((byte) 1);
				}
				count.setStatisticCount(selectDTO.getBreakerProCount());
				countManager.createOrUpdateProtectionDeviceCount(count);
			}
			selectDTO = null;
			queryByStatisticalDimensionAndYear();
		}
	}

	/*
	 * 生成ProtectionDeviceCount
	 */
	private ProtectionDeviceCount createProtectionDeviceCount(byte operateStatus, Date updateTime, byte statisticType,
			String unitName, Byte unitType, int voltage) {
		ProtectionDeviceCount count = new ProtectionDeviceCount();
		count.setOperateStatus(operateStatus);
		count.setStatisticTime(updateTime);
		count.setStatisticType(statisticType);// 保护类型，断路器保护
		count.setUnitName(unitName);
		count.setUnitType(unitType);
		count.setVoltageLevel(voltage);
		return count;
	}

	private Long getRowSummary(ProtectionDeviceCountDTO dto) {
		Long c = 0L;
		if (dto.getLineProCount() != null)
			c += dto.getLineProCount();
		if (dto.getBusProCount() != null)
			c += dto.getBusProCount();
		if (dto.getTransformerProCount() != null)
			c += dto.getTransformerProCount();
		if (dto.getAlternatorProCount() != null)
			c += dto.getAlternatorProCount();
		if (dto.getReactorProCount() != null)
			c += dto.getReactorProCount();
		if (dto.getSeriesCompensationProCount() != null)
			c += dto.getSeriesCompensationProCount();
		if (dto.getShortLeadProCount() != null)
			c += dto.getShortLeadProCount();
		if (dto.getBreakerProCount() != null)
			c += dto.getBreakerProCount();

		return c;
	}

	public int getStatisticalDimension() {
		return statisticalDimension;
	}

	public void setStatisticalDimension(int statisticalDimension) {
		this.statisticalDimension = statisticalDimension;
	}

	public int getYear() {
		return year;
	}

	public void setYear(int year) {
		this.year = year;
	}

	public List<ProtectionDeviceCountDTO> getList() {
		return list;
	}

	public void setList(List<ProtectionDeviceCountDTO> list) {
		this.list = list;
	}

	public ProtectionDeviceCountDTO getSelectDTO() {
		return selectDTO;
	}

	public void setSelectDTO(ProtectionDeviceCountDTO selectDTO) {
		this.selectDTO = selectDTO;
	}

	public String[] getSelectedVoltageArray() {
		return selectedVoltageArray;
	}

	public void setSelectedVoltageArray(String[] selectedVoltageArray) {
		this.selectedVoltageArray = selectedVoltageArray;
	}

	public String getUpdateTime() {
		return updateTime;
	}

	public String getQueryYear() {
		return queryYear;
	}

	public void setQueryYear(String queryYear) {
		this.queryYear = queryYear;
	}

	public void setUpdateTime(String updateTime) {
		this.updateTime = updateTime;
	}

	public Boolean getReStatisticStatus() {
		return reStatisticStatus;
	}

	public void setReStatisticStatus(Boolean reStatisticStatus) {
		this.reStatisticStatus = reStatisticStatus;
	}

	public Map<String, String> getSummaryMap() {
		return summaryMap;
	}

	public void setSummaryMap(Map<String, String> summaryMap) {
		this.summaryMap = summaryMap;
	}

	public class ProtectionDeviceCountDTO {

		private String id;
		/**
		 * 统计维度名称
		 */
		private String unitName;

		private int voltage;
		/**
		 * 保护类型 -1：未知 0：线路、辅助保护 1：母线保护 2：变压器保护 3：发电机保护 4：电抗器保护 5：串补保护 6：短引线保护 7：断路器保护
		 * 8：故障录波器 9：网络设备
		 */
		private Long unknowProCount;// 未知类型
		private Long lineProCount;// 线路保护
		private Long busProCount;// 母线保护
		private Long transformerProCount;// 变压器
		private Long alternatorProCount;// 发电机
		private Long reactorProCount;// 电抗器
		private Long seriesCompensationProCount;// 串补保护
		private Long shortLeadProCount;// 短引线保护
		private Long breakerProCount;// 断路器保护
		private Long recorderProCount;// 录波器保护
		private Long networkProCount;// 网络设备
		private Long state; // 状态，是否被编辑
		private Long summary;// 汇总

		public String getId() {
			return id;
		}

		public void setId(String id) {
			this.id = id;
		}

		public String getUnitName() {
			return unitName;
		}

		public void setUnitName(String unitName) {
			this.unitName = unitName;
		}

		public int getVoltage() {
			return voltage;
		}

		public void setVoltage(int voltage) {
			this.voltage = voltage;
		}

		public Long getUnknowProCount() {
			return unknowProCount;
		}

		public void setUnknowProCount(Long unknowProCount) {
			this.unknowProCount = unknowProCount;
		}

		public Long getLineProCount() {
			return lineProCount;
		}

		public void setLineProCount(Long lineProCount) {
			this.lineProCount = lineProCount;
		}

		public Long getBusProCount() {
			return busProCount;
		}

		public void setBusProCount(Long busProCount) {
			this.busProCount = busProCount;
		}

		public Long getTransformerProCount() {
			return transformerProCount;
		}

		public void setTransformerProCount(Long transformerProCount) {
			this.transformerProCount = transformerProCount;
		}

		public Long getAlternatorProCount() {
			return alternatorProCount;
		}

		public void setAlternatorProCount(Long alternatorProCount) {
			this.alternatorProCount = alternatorProCount;
		}

		public Long getReactorProCount() {
			return reactorProCount;
		}

		public void setReactorProCount(Long reactorProCount) {
			this.reactorProCount = reactorProCount;
		}

		public Long getSeriesCompensationProCount() {
			return seriesCompensationProCount;
		}

		public void setSeriesCompensationProCount(Long seriesCompensationProCount) {
			this.seriesCompensationProCount = seriesCompensationProCount;
		}

		public Long getShortLeadProCount() {
			return shortLeadProCount;
		}

		public void setShortLeadProCount(Long shortLeadProCount) {
			this.shortLeadProCount = shortLeadProCount;
		}

		public Long getBreakerProCount() {
			return breakerProCount;
		}

		public void setBreakerProCount(Long breakerProCount) {
			this.breakerProCount = breakerProCount;
		}

		public Long getRecorderProCount() {
			return recorderProCount;
		}

		public void setRecorderProCount(Long recorderProCount) {
			this.recorderProCount = recorderProCount;
		}

		public Long getNetworkProCount() {
			return networkProCount;
		}

		public void setNetworkProCount(Long networkProCount) {
			this.networkProCount = networkProCount;
		}

		public Long getState() {
			return state;
		}

		public void setState(Long state) {
			this.state = state;
		}

		public Long getSummary() {
			return summary;
		}

		public void setSummary(Long summary) {
			this.summary = summary;
		}

	}

}
